package com.itheima.zuoye.zuoye2;

import java.util.Comparator;

public class studentclass  implements Comparator<studentclass> {
    private int id;
    private String name;
    private int sex;

    public studentclass() {
    }

    public studentclass(int id, String name, int sex) {
        this.id = id;
        this.name = name;
        this.sex = sex;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "studentclass{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", sex=" + sex +
                '}';
    }

    @Override
    public int compare(studentclass o1, studentclass o2) {
        return o1.getSex()-o2.getSex();
    }
}
